<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Profile</title>
<script src="references/js/jquery-2.1.0.min.js"></script>
<script>
	$(function() {
		$("#email").attr("pattern", "[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$");
		$("#email").attr("required", "");
		$("#bankAccountNo").attr("pattern", "[0-9]*");
		$("#name").attr("required", "");
	});
</script>
</head>
<body>
	<tiles:insertTemplate template="/pages/masterpage/masterPage.jsp">

		<tiles:putAttribute name="body">
			<logic:empty name="username" scope="session">
				<logic:forward name="home" />
			</logic:empty>


			<logic:equal name="role" value="Member">

				<div id="loginbox" style="margin-top: 50px;"
					class="mainbox col-md-6 col-md-offset-3 col-sm-8 col-sm-offset-2">
					<div class="panel panel-info">
						<div class="panel-heading">
							<div class="panel-title">Your Profile</div>
						</div>

						<div style="padding-top: 30px" class="panel-body">

							<div style="display: none" id="login-alert"
								class="alert alert-danger col-sm-12"></div>

							<html:form action="/updateProfile" method="post"
								onsubmit="return checkPass();" styleClass="form-horizontal">


								<div style="margin-bottom: 25px" class="input-group">

								<strong>	${username} </strong></div>

								<div style="margin-bottom: 25px" class="input-group">
									<span class="input-group-addon"><i
										class="glyphicon glyphicon-envelope"></i></span>
									<html:text property="email" value="${userInfo.email }"
										styleClass="form-control" styleId="email"></html:text>
								</div>

								<div style="margin-bottom: 25px" class="input-group">
									<span class="input-group-addon"><i
										class="glyphicon glyphicon-user"></i></span> 
									<html:text property="name" value="${userInfo.name }"
										styleClass="form-control" styleId="name"></html:text>
								</div>

								<div style="margin-bottom: 25px" class="input-group">
									<span class="input-group-addon"><i
										class="fa fa-money"></i></span>
									   
									     <input class="form-control" id="disabledInput" type="text" value="${userInfo.balance }" disabled>
								</div>
								



								<div style="margin-top: 10px" class="form-group">
									<!-- Button -->

									<div class="col-sm-12 controls">
										<html:submit styleClass="btn btn-success">Change</html:submit>
										<br> <span id="confirmMessage" class="confirmMessage"></span>
										<logic:notEmpty name="info">
											<bean:write name="info" />
											<br>
										</logic:notEmpty>

									</div>
								</div>


					
							</html:form>



						</div>
					</div>
				</div>

			</logic:equal>


			<logic:equal name="role" value="Developer">

				<div id="loginbox" style="margin-top: 50px;"
					class="mainbox col-md-6 col-md-offset-3 col-sm-8 col-sm-offset-2">
					<div class="panel panel-info">
						<div class="panel-heading">
							<div class="panel-title">Your Profile</div>
						</div>

						<div style="padding-top: 30px" class="panel-body">

							<div style="display: none" id="login-alert"
								class="alert alert-danger col-sm-12"></div>

							<html:form action="/updateProfile" method="post"
								onsubmit="return checkPass();" styleClass="form-horizontal">




								<div style="margin-bottom: 25px" class="input-group">
									<span class="input-group-addon"><i
										class="glyphicon glyphicon-envelope"></i></span>
									<html:text property="email" value="${userInfo.email }"
										styleClass="form-control" styleId="email"></html:text>
								</div>

								<div style="margin-bottom: 25px" class="input-group">
									<span class="input-group-addon"><i
										class="glyphicon glyphicon-user"></i></span>
									<html:text property="name" value="${userInfo.name }"
										styleClass="form-control" styleId="name"></html:text>
								</div>
								<div style="margin-bottom: 25px" class="input-group">
									<span class="input-group-addon"><i
										class="glyphicon glyphicon-sound-6-1"></i></span>
									<html:text property="bankAccountNo" styleClass="form-control"
										value="${userInfo.bankAccountNo }" styleId="bankAccountNo"></html:text>
								</div>
								<div style="margin-bottom: 25px" class="input-group">
									<span class="input-group-addon"><i
										class="glyphicon glyphicon-barcode"></i></span> 
									<html:text property="bankAccountName" styleClass="form-control"
										value="${userInfo.bankAccountName }" styleId="bankAccountName"></html:text>
								</div>

								<div style="margin-bottom: 25px" class="input-group">
									<span class="input-group-addon"><i
										class="fa fa-bank"></i></span> 
									<html:text property="bankName" styleClass="form-control"
										value="${userInfo.bankName }" styleId="bankName"></html:text>
								</div>
								<div style="margin-bottom: 25px" class="input-group">
									<span class="input-group-addon"><i
										class="glyphicon glyphicon-credit-card"></i></span>
									<html:text property="paypal" styleClass="form-control"
										value="${userInfo.paypal }" styleId="paypal"></html:text>
								</div>
									<div style="margin-bottom: 25px" class="input-group">
									<span class="input-group-addon"><i
										class="fa fa-money"></i></span>
										 <input class="form-control" id="disabledInput" type="text" value="${userInfo.balance }" disabled>
								</div>


								<div style="margin-top: 10px" class="form-group">
									<!-- Button -->

									<div class="col-sm-12 controls">
										<html:submit styleClass="btn btn-success">Change</html:submit>
										<html:link action="/directorRequestMoney" styleClass="btn btn-primary">Request Money</html:link>
										<br> <span id="confirmMessage" class="confirmMessage"></span>
										<logic:notEmpty name="info">
											<bean:write name="info" />
											<br>
										</logic:notEmpty>

									</div>
								</div>
	


							</html:form>



						</div>
					</div>
				</div>
			</logic:equal>

		</tiles:putAttribute>
	</tiles:insertTemplate>
</body>
</html>